﻿using Me.Amon.C;
namespace Me.Amon.M
{
    public class MObj
    {
        /// <summary>
        /// 错误代码
        /// </summary>
        public int error_code;
        /// <summary>
        /// 错误消息
        /// </summary>
        public string error_message;

        public bool HasError()
        {
            return error_code != PObj.ERROR_CODE_NORMAL;
        }

        public virtual string GetError()
        {
            switch (error_code)
            {
                case PObj.ERROR_CODE_CUSTOM:
                    return error_message;
                case PObj.ERROR_CODE_OPT_EMPTY:
                    return "操作类型为空！";
                case PObj.ERROR_CODE_OPT_ERROR:
                    return "无效的操作类型！";
                default:
                    return "未知的错误！";
            }
        }
    }
}
